function doLogin() {
	username = $("#username").val();
	password = $("#password").val();
	if (username == "" || password == "") {
		alert("用户名或密码不能为空");
	} else {
		request = new Object();
		request.operation = "login";
		request.jsonObject = new Object();
		request.jsonObject.username = username;
		request.jsonObject.password = password;
		$.post("Gate", {
			req : JSON.stringify(request)
		}, function(data, status) {
			// alert(status);
			var resp = eval("(" + data + ')');
			if (resp.status == 0) {
				window.location.href = "index.html";
			} else {
				alert("登录失败:" + resp.message);
			}
		});
	}
}

$('#password').keydown(function(ev) {
	if (ev.keyCode == 13||ev.key=="Enter") {
		doLogin();
	}
});
